/* Copyright 2012 Ilkka Kiistala

This file is part of the Crossmodal-Framework. The Crossmodal-Framework is free software: you can redistribute it and/or modify it under the terms of the GNU 
General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Crossmodal-Framework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along 
with the Crossmodal Framework.  If not, see <http://www.gnu.org/licenses/> */

package com.example.jsontotactons;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Tacton {
    private String name = null;
    //private long [] structure = null;
    // [100,200,100]
//    ArrayList<?> structure;
    long[] structure;

    public Tacton(String name) {
        this.name = name;
    }

//    public Tacton(String name, ArrayList<?> list) {
//        this(name);
//        // this.structure = structure;
//        this.structure = list;
//        
//    }

    public Tacton(String string, long[] ls) {
		// TODO Auto-generated constructor stub
        this(string);
        this.structure = ls;
	}

    public Tacton(long[] ls) {
		// TODO Auto-generated constructor stub
        this("Unnamed Tacton");
        this.structure = ls;
	}

//	public ArrayList<?> getStructure() {
//        return structure;
//    }

    public String getName() {
        return name;
    }

	public long[] getStructureTest() {
		// TODO Auto-generated method stub
	    // return structure.get(index);
		return ( new long[] {200,400,200,400,200} );
		// return structure;
	}

	public String toString()
	{
		String str = "";
		str += "name: " + this.name + "\n";

		int len = this.structure.length;
		
		for (int i=0;i < len;i++)
		{
			str += this.structure[i] + "\n";
		} 

		// str += getStructureLongs().toString();
		return str;
	}

	public long[] getStructure() {
		// TODO Auto-generated method stub
		return structure;
	}
	
    public long duration()
    {
        long sum = 0;
        for (int i = 0; i < this.structure.length; i++)
        {
            sum += this.structure[i];
        }
        return sum;
    }

	public String getTimes() {
		String str = "";
		for (int i = 0; i < this.structure.length; i++)
        {
            str += this.structure[i] + " ";
        }
		return str;
	}
	
}
